package com.qxbb.report.Enum;

public enum Quarter {

    SPRING(1, "春季"),

    SUMMER(2, "夏季"),

    AUTUMN(3, "秋季"),

    WINTER(4, "冬季"),

    AUTUMNTWO(7, "秋二"),

    OTHER(9, "其他"),

    FOUR_SEASONS(8, "四季");


    private final Integer sort;

    private final String msg;

    Quarter(Integer sort, String msg) {
        this.sort = sort;
        this.msg = msg;
    }

    private String getMsg() {
        return msg;
    }

    /**
     * 获取季度信息
     * @param sort
     * @return
     */
    public static String getMsg(Integer sort) {
        for (Quarter value : Quarter.values()) {
            if (sort == value.sort) {
                return value.msg;
            }
        }
        return OTHER.msg;
    }

    /**
     * 查询该季度0排序号
     * @param msg
     * @return
     */
    public static  Integer getSort(String msg){
        for (Quarter value : Quarter.values()) {
            if (msg.equals(value.getMsg())){
                return value.sort;
            }
        }
        return null;
    }

}
